package com.cmti.skeleton.dao.mapper;

import org.apache.ibatis.jdbc.SQL;

import com.cmti.skeleton.entity.SysRights;

public class SysRightsSqlProvider {

    public String insertSelective(SysRights record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("sys_rights");
        
        if (record.getName() != null) {
            sql.VALUES("NAME", "#{name,jdbcType=VARCHAR}");
        }
        
        if (record.getSortOrder() != null) {
            sql.VALUES("SORT_ORDER", "#{sortOrder,jdbcType=INTEGER}");
        }
        
        if (record.getStatus() != null) {
            sql.VALUES("STATUS", "#{status,jdbcType=INTEGER}");
        }
        
        if (record.getpId() != null) {
            sql.VALUES("P_ID", "#{pId,jdbcType=BIGINT}");
        }
        
        if (record.getRemark() != null) {
            sql.VALUES("REMARK", "#{remark,jdbcType=VARCHAR}");
        }
        
        if (record.getType() != null) {
            sql.VALUES("TYPE", "#{type,jdbcType=TINYINT}");
        }
        
        if (record.getLogInfo() != null) {
            sql.VALUES("LOG_INFO", "#{logInfo,jdbcType=VARCHAR}");
        }
        
        if (record.getUrl() != null) {
            sql.VALUES("URL", "#{url,jdbcType=VARCHAR}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(SysRights record) {
        SQL sql = new SQL();
        sql.UPDATE("sys_rights");
        
        if (record.getName() != null) {
            sql.SET("NAME = #{name,jdbcType=VARCHAR}");
        }
        
        if (record.getSortOrder() != null) {
            sql.SET("SORT_ORDER = #{sortOrder,jdbcType=INTEGER}");
        }
        
        if (record.getStatus() != null) {
            sql.SET("STATUS = #{status,jdbcType=INTEGER}");
        }
        
        if (record.getpId() != null) {
            sql.SET("P_ID = #{pId,jdbcType=BIGINT}");
        }
        
        if (record.getRemark() != null) {
            sql.SET("REMARK = #{remark,jdbcType=VARCHAR}");
        }
        
        if (record.getType() != null) {
            sql.SET("TYPE = #{type,jdbcType=TINYINT}");
        }
        
        if (record.getLogInfo() != null) {
            sql.SET("LOG_INFO = #{logInfo,jdbcType=VARCHAR}");
        }
        
        if (record.getUrl() != null) {
            sql.SET("URL = #{url,jdbcType=VARCHAR}");
        }
        
        sql.WHERE("ID = #{id,jdbcType=BIGINT}");
        
        return sql.toString();
    }
}